<template>
  <div>
    <!-- <p>待检验犬只</p> -->

    <el-table :data="doginfo" style="width: 100%">
      <el-table-column label="正面照" width="150">
        <template slot-scope="scope">
          <el-avatar
            shape="square"
            :size="100"
            :src="scope.row.full_face_photo"
          ></el-avatar>
        </template>
      </el-table-column>
      <el-table-column label="犬名" width="100">
        <template slot-scope="scope">
          <el-tag type="success">{{ scope.row.dname }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="犬种" width="100">
        <template slot-scope="scope">
          <el-tag type="success">{{ scope.row.dtype }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column label="犬主" width="100">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.user.name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="证件号" width="200">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.user.icd }}</span>
        </template>
      </el-table-column>
      <el-table-column label="电话" width="150">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.tel }}</span>
        </template>
      </el-table-column>
      <el-table-column label="登记时间" width="200">
        <template slot-scope="scope">
          <i class="el-icon-time"></i>
          <span style="margin-left: 10px">{{ scope.row.check_time }}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" width="100">
        <template slot-scope="scope">
          <el-tag type="danger">
            {{ statustype(scope.row.status) }}
          </el-tag>
          <!-- <span style="margin-left: 10px">{{ scope.row.status }}</span> -->
        </template>
      </el-table-column>
      <el-table-column label="操作" width="240">
        <template slot-scope="scope">
          <el-button type="primary" @click="verification(scope.row.id)">立即核验</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      doginfo: [],
      type: ["已登记", "未通过", "已通过"],
    };
  },
  methods: {
  //进入犬只核验页面
    verification(id) {
      sessionStorage.setItem("rid", id);
     
      this.$router.push({ path: "/hospital/verification/inspect_pet"});
    },
    //获取未核验犬只
    init() {
      this.$axios
        .get(
          "http://localhost:9091/immune/immune/status",
          //未核验犬只
          { params: { status: 0 } }
        )
        .then((resp) => {
          if (resp.data.code == 200) {
           // console.log(resp);
            this.doginfo = resp.data.data;
            //console.log( this.doginfo)
            this.$message({
              type: "success",
              message: resp.data.message,
            });
          } else {
            this.$message({
              type: "info",
              message: resp.data.message,
            });
          }
        });
    },
    //判断状态
    statustype(status) {
      return this.type[status];
    },
  },
  mounted() {
    this.init();
  },
  computed: {},
};
</script>
<style scoped></style>
